{% extends "base.html" %}


{% block css %}
<link rel="stylesheet" href="/static/css/tagging.css" />
{% endblock %}

{% block nav_videos %}<li><a href="/">Videos</a></li>{% endblock %}
{% block report %}<li class="active"><a href="/curation_report">Report</a></li>{% endblock %}


{% block content %}

{% if report_data %}
  <table class="table">
    <tr>
      <th>Videos</th>
      <th>YouTube Playlist ID</th>
      <th>Last Synced to YouTube</th>
      <th></th>
    </tr>
    {% for playlist in report_data %}
    <form method="POST" action="/curation_report"/>
    <input type="hidden" name="playlistid" value="{{ playlist.playlistid}}" />
    <tr>
      <td>{{ playlist.total}}</td>
      <td>{{ playlist.playlistid}}</td>
      <td>{{ playlist.last_synced|default:"Not Synced"}}</td>
      <td><input class="btn" type="submit" value="Run Performance Report"></td>
    </tr>
    </form>
    {% endfor %}
  </table>
{% endif %}

{% if youtube_performance_report %}
  <table class="table">
    <tr>
      <th>Title</th>
      <th>VideoID</th>
      <th>View Count</th>
      <th>Updated View Count</th>
      <th>% Increase</th>
    </tr>
    {% for video in youtube_performance_report %}
    <tr>
      <td>{{ video.title}}</td>
      <td>{{ video.videoid}}</td>
      <td>{{ video.view_count }}</td>
      <td>{{ video.updated_view_count }}</td>
      <td>{{ video.percent_diff|floatformat:2 }}%</td>
    </tr>
    {% endfor %}
  </table>
{% endif %}

{% endblock %}
